package com.liuxn.dubbo.sample.demo.controller;

import com.liuxn.dubbo.sample.demo.DemoApi;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liuxn
 * @date 2024/10/10
 */
@Slf4j
@RestController
//@ApiSupport(order = 1)
//@Api(tags = "demo示例")
public class DemoController {

    @DubboReference
    DemoApi demoApi;

    @RequestMapping(value = "/demo", method = RequestMethod.GET)
    //@ApiOperation(value = "01示例1", position = 1, notes = "demo示例1")
    public String demo(String req) {
        String demo = demoApi.demoMethod(req);
        log.info(">> 消费者请求：" + req + ",生产者返回：" + demo);
        return demo;
    }

    @RequestMapping(value = "/demo2", method = RequestMethod.GET)
    //@ApiOperation(value = "01示例1", position = 2, notes = "demo示例2")
    public String demo1(String req) {
        String demo = demoApi.demoMethod(req);
        log.info(">> 消费者请求：" + req + ",生产者返回：" + demo);
        return demo;
    }

}
